#include <hildon/hildon-program.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkbox.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkbutton.h>

int hello_callback(GtkWidget *self, gpointer *label)
{
    gtk_label_set_markup_with_mnemonic (GTK_LABEL(label),
      "<big>Hello Maemo!</big>");
}

int main(int argc, char *argv[])
{
    /* Create needed variables */
    HildonProgram *program;
    HildonWindow *window;
    GtkWidget *vbox;
    GtkWidget *label;
    GtkWidget *button;

    /* Initialize the GTK. */
    gtk_init(&argc, &argv);

    /* Create the hildon program and setup the title */
    program = HILDON_PROGRAM(hildon_program_get_instance());
    g_set_application_name("Hello maemo!");

    /* Create HildonWindow and set it to HildonProgram */
    window = HILDON_WINDOW(hildon_window_new());
    hildon_program_add_window(program, window);

    /* Create a vertical box container and add it to main view */
    vbox = GTK_WIDGET(gtk_vbox_new(FALSE, 2));
    gtk_container_add(GTK_CONTAINER(window), vbox);

    /* Create label and add it to vbox */
    label = GTK_WIDGET(gtk_label_new("..."));
    gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
    
    /* Create button and add it to main view */
    button = gtk_button_new_with_label("Click Me!");
    gtk_widget_set_size_request(button, -1, 50);
    gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, TRUE, 0);
    g_signal_connect(G_OBJECT(button), "clicked",
                     G_CALLBACK(hello_callback), G_OBJECT(label));

    /* Connect signal to X in the upper corner */
    g_signal_connect(G_OBJECT(window), "delete_event",
                     G_CALLBACK(gtk_main_quit), NULL);

    /* Begin the main application */
    gtk_widget_show_all(GTK_WIDGET(window));
    gtk_main();

    /* Exit */
    return 0;
}

